package com.example.pceb.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.pceb.entity.Enterprise;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Repository
@Mapper
public interface EnterpriseMapper extends BaseMapper<Enterprise> {
    @Select("SELECT id FROM enterprise")
    List<String> selectAllIds();

    @Select("SELECT enterprise, address FROM enterprise")
    List<Map<String, String>> selectAllEnterprisesForMap();

    @Select("SELECT enterprise FROM enterprise WHERE username = #{username}")
    String selectEnterpriseNameByUsername(@Param("username") String username);

    @Select("SELECT COUNT(*) FROM enterprise")
    int countAllEnterprises();
}